home *** CD-ROM | disk | FTP | other *** search
/ D.I.S.C. 4 / D.I.S.C. 4.adf / sources / blitterdecode.s next >
Text File  |  1988-01-19  |  2KB  |  88 lines

  1. ;­MFM-decode (using blitter)
  2. ;­by Duke for DISC #4
  3.  
  4. wblit:    macro
  5.     btst    #14,2(a6)
  6.     dc.w    $66f8
  7.     endm
  8. color:    macro
  9.     move.w    #\1,$180(a6)
  10.     endm
  11.  
  12. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  13.         jmp    Start
  14.         org    $45000
  15.         load    $45000
  16. S:
  17. Start:
  18. decode_track:
  19.     movem.l    d0-d7/a0-a5,-(a7)
  20.     lea    $dff000,a6
  21.     lea    s(pc),a5
  22.     lea    trackbuff(pc),a0
  23.     move.l    bufferpt(pc),a1
  24.     move.l    #$55555555,d6
  25.     move.w    #11-1,d7    ;decode    11 sectors
  26. decode_sectors:
  27.     cmpi.w    #$4489,(a0)+    ;search 1st sync
  28.     bne.s    decode_sectors
  29. search_syncs:
  30.     cmpi.w    #$4489,(a0)    ;search remaining syncs (if there're any)
  31.     bne.s    syncs_skipped
  32.     addq.w    #2,a0
  33.     bra.s    search_syncs
  34. syncs_skipped:
  35.     move.l    (a0)+,d0    ;infoblock (odd)
  36.     move.l    (a0)+,d1    ;infoblock (even)
  37.     and.l    d6,d0
  38.     and.l    d6,d1
  39.     add.l    d0,d0
  40.     or.l    d1,d0
  41.     
  42.     swap    d0
  43.     andi.w    #$ff00,d0
  44.     cmpi.w    #$ff00,d0    ;compare format-sign
  45.     bne.s    format_error    ;error if sign <> -1
  46.     swap    d0
  47.     andi.w    #$ff00,d0    ;mask sector-number
  48.     add.w    d0,d0        ;calc. offset
  49.     
  50.     move.l    a1,a2        ;save a1
  51.     adda.w    d0,a1        ;a1=destination
  52.     
  53. ;­ blitter-decode ­
  54.     lea    48(a0),a0    ;skip rest of header
  55.  
  56.     lea    510(a0),a0    ;a0=last word of odd bits (source a)
  57.  
  58.     lea    512(a0),a3    ;a3=last word of even bits (source b)
  59.     lea    510(a1),a1    ;a1=destination (dest d)
  60.  
  61.     wblit                ;waitblit
  62.     move.l    #$1dd80002,$40(a6)    ;con0/con1
  63.     moveq    #-1,d0
  64.     move.l    d0,$44(a6)        ;afwm/alwm
  65.     moveq    #0,d0
  66.     move.l    d0,$64(a6)        ;amod/dmod
  67.     move.l    d0,$60(a6)        ;cmod/bmod
  68.     move.w    #$5555,$70(a6)        ;cdat
  69.     move.l    a0,$50(a6)        ;apt
  70.     move.l    a3,$4c(a6)        ;bpt
  71.     move.l    a1,$54(a6)        ;dpt
  72.     move.w    #[256*64]+1,$58(a6)    ;bltsize
  73.     move.l    a3,a0
  74.     move.l    a2,a1
  75.     dbf    d7,decode_sectors
  76.     addi.l    #$1600,bufferpt-s(a5)
  77.     movem.l    (a7)+,d0-d7/a0-a5
  78.     Rts
  79.  
  80. format_error:
  81.     color    $f00
  82.     Rts
  83. bufferpt:
  84.     dc.l    buffer
  85. trackbuff:
  86.     blk.b    12000,0            ;store mfm-data here
  87. buffer:
  88.